package com.oyjd.business.set.activity;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.oyjd.R;
import com.oyjd.framework.ui.corner.CornerView;
import com.oyjd.framework.ui.title.TitleBar;

public class SettingActivity extends Activity {
	private LayoutInflater flater;// 布局加载器

	private TitleBar titleBar;
	private CornerView corner_about;
	private CornerView corner_sys;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.act_setting_demo);

		// 初始化布局加载器
		flater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		titleBar = (TitleBar) this.findViewById(R.id.titleBar);
		titleBar.setTitleText("更多设置");

		corner_about = (CornerView) this.findViewById(R.id.corner_about);
		List<View> aboutData = new ArrayList<View>();
		aboutData.add(createView("我的收藏", null));
		corner_about.setData(aboutData);

		corner_sys = (CornerView) this.findViewById(R.id.corner_sys);
		List<View> sysData = new ArrayList<View>();
		sysData.add(createView("检测新版本", "当前版本为最新版本，版本号1"));
		sysData.add(createView("关于", null));
		sysData.add(createView("退出程序", null));
		corner_sys.setData(sysData);
	}

	private View createView(String info, String infoEx) {
		View view = flater.inflate(R.layout.corner_item, null);
		TextView item_txt = (TextView) view.findViewById(R.id.item_txt);
		item_txt.setText(info);
		if (null != infoEx) {
			TextView item_more = (TextView) view.findViewById(R.id.item_more);
			item_more.setText(infoEx);
			item_more.setVisibility(View.VISIBLE);
		}
		return view;
	}

}
